<template>
	<view>
		<hx-navbar ref="hxnb" :config="config" />
		<view style="color: #1E1E1E;font-size: 48rpx;margin-left: 30rpx;">验证码</view>
		<view style="margin: 30rpx ;">
			<xt-verify-code v-model="verifyCode" @confirm="confirm"></xt-verify-code>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 标题栏配置
				config: {
					title: "",
					back: true,
				},
				sign: '',
				verifyCode: null,
			};
		},
		onLoad(e) {
			console.log(e.sign, '小辞职信辞职信')
			this.sign = e.sign
			this.phone = e.phone
		},
		onShow() {},
		mounted() {},
		methods: {
			confirm(e) {
				let data = {
					phone: this.phone,
					code: this.verifyCode,
					signCode: this.sign

				}
				// uni.navigateTo({
				// 	url:'/pages/login/guide'
				// })
				this.$api.login(data).then((res) => {
					console.log(res.data, '持续性')
					this.$cache.set('token', res.data.result.token)
					this.$cache.set('phone', res.data.result.phone)
					this.$cache.set('id', res.data.result.id)
					this.$cache.set('type', res.data.result.type)
					this.$cache.set('name', res.data.result.name)
					this.$cache.set('avatar', res.data.result.avatar)
					if (res.data.result.newUser == 2) {
						uni.switchTab({
							url: '/pages/tabbar/clientEndTabbar/ClientHome',
							animationType: 'zoom-fade-out',
							animationDuration: 500,
						})
					} else {
						uni.navigateTo({
							url: './guide?id=' + res.data.result.id,
							animationType: 'zoom-fade-out',
							animationDuration: 500,
						})
					}
				})
			},
		},
	};
</script>

<style lang="scss">
	page {
		overflow: hidden;
		background-color: #ffffff;
	}
</style>